package c.h.a.x.t;

import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.graphics.Rect;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnLongClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.RecyclerView.e;
import androidx.recyclerview.widget.RecyclerView.l;
import androidx.recyclerview.widget.RecyclerView.w;
import androidx.recyclerview.widget.RecyclerView.z;
import c.h.a.m0.h;
import com.liuzh.deviceinfo.DeviceInfoApp;
import java.util.List;

/* compiled from: ActivitiesData */
public class c implements l {
    public List<b> a;
    public Fragment b;

    /* compiled from: ActivitiesData */
    public static class b {
        public final ActivityInfo a;
        public boolean b = false;
        public final ComponentName c;

        public b(ActivityInfo activityInfo) {
            this.a = activityInfo;
            this.c = new ComponentName(activityInfo.packageName, activityInfo.name);
        }
    }

    /* compiled from: ActivitiesData */
    public static class a extends Fragment {
        public c W;
        public RecyclerView X;
        public Context Y;
        public b Z;

        /* compiled from: ActivitiesData */
        public class a extends l {
            public int a = h.t(8.0f, DeviceInfoApp.c.getResources().getDisplayMetrics());

            public void f(Rect rect, View view, RecyclerView recyclerView, w wVar) {
                int J = recyclerView.J(view);
                int i = this.a;
                rect.left = i;
                rect.right = i;
                if (J == 0) {
                    rect.top = i;
                } else if (J == a.this.Z.a() - 1) {
                    rect.bottom = this.a;
                }
            }
        }

        /* compiled from: ActivitiesData */
        public class b extends e<a> {
            public LayoutInflater c;
            public PackageManager d;

            /* compiled from: ActivitiesData */
            public class a extends z implements OnClickListener, OnLongClickListener {
                public TextView A;
                public View B;
                public TextView C;
                public View D;
                public TextView E;
                public View F;
                public View G;
                public View H;
                public View I;
                public ImageView J;
                public TextView t;
                public TextView u;
                public View v;
                public TextView w;
                public View x;
                public TextView y;
                public View z;

                public a(View view) {
                    super(view);
                    this.H = view.findViewById(2131296505);
                    this.I = view.findViewById(2131296606);
                    this.J = (ImageView) view.findViewById(2131296375);
                    this.I.setOnClickListener(this);
                    this.I.setOnLongClickListener(this);
                    this.t = (TextView) view.findViewById(2131296328);
                    TextView textView = (TextView) view.findViewById(2131296662);
                    this.u = textView;
                    View view2 = (View) textView.getParent();
                    this.v = view2;
                    view2.setOnClickListener(this);
                    this.v.setOnLongClickListener(this);
                    textView = (TextView) view.findViewById(2131296792);
                    this.w = textView;
                    view2 = (View) textView.getParent();
                    this.x = view2;
                    view2.setOnClickListener(this);
                    this.x.setOnLongClickListener(this);
                    textView = (TextView) view.findViewById(2131297027);
                    this.E = textView;
                    view2 = (View) textView.getParent();
                    this.F = view2;
                    view2.setOnClickListener(this);
                    this.F.setOnLongClickListener(this);
                    textView = (TextView) view.findViewById(2131296975);
                    this.y = textView;
                    view2 = (View) textView.getParent();
                    this.z = view2;
                    view2.setOnClickListener(this);
                    this.z.setOnLongClickListener(this);
                    textView = (TextView) view.findViewById(2131296773);
                    this.A = textView;
                    view2 = (View) textView.getParent();
                    this.B = view2;
                    view2.setOnClickListener(this);
                    this.B.setOnLongClickListener(this);
                    textView = (TextView) view.findViewById(2131296673);
                    this.C = textView;
                    view2 = (View) textView.getParent();
                    this.D = view2;
                    view2.setOnClickListener(this);
                    this.D.setOnLongClickListener(this);
                    view2 = view.findViewById(2131296672);
                    this.G = view2;
                    view2.setOnClickListener(this);
                }

                public void onClick(View view) {
                    b bVar = (b) a.this.W.a.get(e());
                    int i = 0;
                    if (view == this.G) {
                        try {
                            Intent intent = new Intent();
                            intent.setComponent(bVar.c);
                            a.this.Y.startActivity(intent);
                        } catch (Exception unused) {
                            Toast.makeText(a.this.Y, 2131690512, 0).show();
                        }
                    } else if (view == this.I) {
                        this.J.animate().rotation(bVar.b ? 0.0f : 180.0f).start();
                        view = this.H;
                        if (bVar.b) {
                            i = 8;
                        }
                        view.setVisibility(i);
                        bVar.b ^= 1;
                    } else {
                        String str = ": ";
                        StringBuilder stringBuilder;
                        if (view == this.v) {
                            stringBuilder = new StringBuilder();
                            c.b.a.a.a.n(a.this.Y, 2131690034, stringBuilder, str);
                            stringBuilder.append(this.u.getText());
                            w(stringBuilder.toString(), 2131689505);
                        } else if (view == this.x) {
                            stringBuilder = new StringBuilder();
                            c.b.a.a.a.n(a.this.Y, 2131690180, stringBuilder, str);
                            stringBuilder.append(this.w.getText());
                            w(stringBuilder.toString(), 2131689509);
                        } else if (view == this.F) {
                            stringBuilder = new StringBuilder();
                            c.b.a.a.a.n(a.this.Y, 2131690444, stringBuilder, str);
                            stringBuilder.append(this.E.getText());
                            w(stringBuilder.toString(), 2131689511);
                        } else if (view == this.z) {
                            stringBuilder = new StringBuilder();
                            c.b.a.a.a.n(a.this.Y, 2131690390, stringBuilder, str);
                            stringBuilder.append(this.y.getText());
                            w(stringBuilder.toString(), 2131689510);
                        } else if (view == this.B) {
                            stringBuilder = new StringBuilder();
                            c.b.a.a.a.n(a.this.Y, 2131690156, stringBuilder, str);
                            stringBuilder.append(this.A.getText());
                            w(stringBuilder.toString(), 2131689508);
                        } else if (view == this.D) {
                            stringBuilder = new StringBuilder();
                            c.b.a.a.a.n(a.this.Y, 2131690042, stringBuilder, str);
                            stringBuilder.append(this.C.getText());
                            w(stringBuilder.toString(), 2131689506);
                        }
                    }
                }

                public boolean onLongClick(View view) {
                    String str = "";
                    if (view == this.I) {
                        c.b.a.a.a.q(this.t, a.this.Y, str);
                    } else if (view == this.v) {
                        c.b.a.a.a.q(this.u, a.this.Y, str);
                    } else if (view == this.x) {
                        c.b.a.a.a.q(this.w, a.this.Y, str);
                    } else if (view == this.F) {
                        c.b.a.a.a.q(this.E, a.this.Y, str);
                    } else if (view == this.z) {
                        c.b.a.a.a.q(this.y, a.this.Y, str);
                    } else if (view == this.B) {
                        c.b.a.a.a.q(this.A, a.this.Y, str);
                    } else if (view != this.D) {
                        return false;
                    } else {
                        c.b.a.a.a.q(this.C, a.this.Y, str);
                    }
                    return true;
                }

                public void w(String str, int i) {
                    b.b.c.f.a aVar = new b.b.c.f.a(a.this.Y);
                    androidx.appcompat.app.AlertController.b bVar = aVar.a;
                    bVar.d = str;
                    bVar.f = bVar.a.getText(i);
                    aVar.b(17039370, null);
                    aVar.g();
                }
            }

            public b() {
                this.c = LayoutInflater.from(a.this.Y);
                this.d = a.this.Y.getPackageManager();
            }

            public int a() {
                c cVar = a.this.W;
                if (cVar == null) {
                    return 0;
                }
                List list = cVar.a;
                if (list == null) {
                    return 0;
                }
                return list.size();
            }

            public void f(z zVar, int i) {
                a aVar = (a) zVar;
                b bVar = (b) a.this.W.a.get(i);
                ActivityInfo activityInfo = bVar.a;
                aVar.t.setText(activityInfo.name);
                aVar.u.setText(activityInfo.loadLabel(this.d));
                CharSequence charSequence = "N/A";
                aVar.w.setText(TextUtils.isEmpty(activityInfo.permission) ? charSequence : activityInfo.permission);
                aVar.E.setText(activityInfo.taskAffinity);
                TextView textView = aVar.y;
                int i2 = activityInfo.softInputMode;
                StringBuilder stringBuilder = new StringBuilder();
                if (h.o(i2, 48)) {
                    stringBuilder.append("Adjust nothing, ");
                }
                if (h.o(i2, 32)) {
                    stringBuilder.append("Adjust pan, ");
                }
                if (h.o(i2, 16)) {
                    stringBuilder.append("Adjust resize, ");
                }
                int i3 = 0;
                if (h.o(i2, 0)) {
                    stringBuilder.append("Adjust unspecified, ");
                }
                if (h.o(i2, 3)) {
                    stringBuilder.append("Always hidden, ");
                }
                if (h.o(i2, 5)) {
                    stringBuilder.append("Always visible, ");
                }
                if (h.o(i2, 2)) {
                    stringBuilder.append("Hidden, ");
                }
                if (h.o(i2, 4)) {
                    stringBuilder.append("Visible, ");
                }
                boolean z = true;
                if (h.o(i2, 1)) {
                    stringBuilder.append("Unchanged, ");
                }
                if (h.o(i2, 0)) {
                    stringBuilder.append("Unspecified, ");
                }
                if (stringBuilder.length() > 2) {
                    stringBuilder.delete(stringBuilder.length() - 2, stringBuilder.length());
                }
                CharSequence stringBuilder2 = stringBuilder.toString();
                if (stringBuilder2.equals("")) {
                    stringBuilder2 = charSequence;
                }
                textView.setText(stringBuilder2);
                textView = aVar.A;
                switch (activityInfo.screenOrientation) {
                    case -1:
                        stringBuilder2 = "Unspecified";
                        break;
                    case 0:
                        stringBuilder2 = "Landscape";
                        break;
                    case 1:
                        stringBuilder2 = "Portrait";
                        break;
                    case 2:
                        stringBuilder2 = "User";
                        break;
                    case 3:
                        stringBuilder2 = "Behind";
                        break;
                    case 4:
                        stringBuilder2 = "Sensor";
                        break;
                    case 5:
                        stringBuilder2 = "No sensor";
                        break;
                    case 6:
                        stringBuilder2 = "Sensor landscape";
                        break;
                    case 7:
                        stringBuilder2 = "Sensor portrait";
                        break;
                    case 8:
                        stringBuilder2 = "Reverse landscape";
                        break;
                    case 9:
                        stringBuilder2 = "Reverse portrait";
                        break;
                    case 10:
                        stringBuilder2 = "Full sensor";
                        break;
                    case 11:
                        stringBuilder2 = "User landscape";
                        break;
                    case 12:
                        stringBuilder2 = "User portrait";
                        break;
                    case 13:
                        stringBuilder2 = "Full user";
                        break;
                    case 14:
                        stringBuilder2 = "Locked";
                        break;
                    default:
                        stringBuilder2 = charSequence;
                        break;
                }
                textView.setText(stringBuilder2);
                textView = aVar.C;
                i2 = activityInfo.launchMode;
                if (i2 == 0) {
                    charSequence = "Multiple";
                } else if (i2 == 1) {
                    charSequence = "Single top";
                } else if (i2 == 2) {
                    charSequence = "Single task";
                } else if (i2 == 3) {
                    charSequence = "Single instance";
                }
                textView.setText(charSequence);
                View view = aVar.G;
                if (!(activityInfo.isEnabled() && activityInfo.exported)) {
                    z = false;
                }
                view.setEnabled(z);
                View view2 = aVar.H;
                if (!bVar.b) {
                    i3 = 8;
                }
                view2.setVisibility(i3);
            }

            public z g(ViewGroup viewGroup, int i) {
                return new a(this.c.inflate(2131492973, viewGroup, false));
            }
        }

        public void D(Context context) {
            super.D(context);
            this.Y = context;
        }

        public View G(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
            if (this.X == null) {
                this.X = (RecyclerView) layoutInflater.inflate(2131492910, viewGroup, false);
                b bVar = new b();
                this.Z = bVar;
                this.X.setAdapter(bVar);
                this.X.g(new a());
            }
            return this.X;
        }
    }

    public String a() {
        return DeviceInfoApp.c.getString(2131689575);
    }

    public Fragment b() {
        if (this.b == null) {
            this.b = new a();
        }
        return this.b;
    }
}
